/* ***********************
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is GetHttpObject.js module.
 *
 * The Initial Developer of the Original Code is Rob Gerns.
 *
 * Portions created by the Initial Developer are Copyright (C) 2010
 * the Initial Developer. All Rights Reserved.
 *
 **************************/


/*************************************************
* Function Name(s): getHttpObject
*
* Purpose:
* Start the AJAX (Make a new XML HTTP Request).
* This is a barely modified pretty standard way of
* doing this.
**************************************************/

function getHttpObject() {

 //set up a new AJAX HTTP request if browser is a non-Microsoft browser
 if(window.XMLHttpRequest) {
  
  xmlObject = new XMLHttpRequest();
 
 }  
 
 //if that doesn't work the browser is likely Microsoft-based, so try to set up AJAX this way
 else if(window.ActiveXObject) {
 
  try {
   //preferred method for Microsoft AJAX, but not every version of IE supports it
   xmlObject = new ActiveXObject("Msxml2.XMLHTTP");
 
  }
  catch(e) {
            
   try {
    //try this if the first IE method didn't work
    xmlObject = new ActiveXObject("Microsoft.XMLHTTP");
 
   }
   //the browser being used doesn't support xmlhttprequest part
   catch(e) {}
 }

 }

    return xmlObject;
}

/**************************************************
* Put the entire XML HTTP Request into the 
* 'http' variable to make life much easier
**************************************************/

http = getHttpObject();